package ccpv;

import java.awt.geom.Point2D;
import java.util.ArrayList;

/**
 * Person defines an agent with parameters used to track characteristics of the person's character.
 * @author Robert Puckett
 *
 */
public class Person {

	public static int count = 0;
	private int id;
	private Point2D.Double position;

	/** Contains the ascriptive characteristics, and other parameters that define the person. */
	private ArrayList<Double> character = new ArrayList<Double>();

	/** Stores the personal history of this person. */ 
	//private ArrayList<Event> history = new ArrayList<Event>();  


	/**
	 * Creates a new person with no parameters or history at position (0,0).
	 */
	public Person() {
		this.id = count;
		count++;
		setPosition(new Point2D.Double(0,0));  
	}

	/**
	 * Creates a person with the given set of parameters that define his character.
	 * @param character A set of parameters.
	 */
	public Person(ArrayList<Double> character) {
		this.id = count;
		count++;
		this.character = character;
	}

	/**
	 * Adds a parameter to the character list that defines the person.
	 * @param param
	 */
	public void addCharacteristic(double char1) {
		this.character.add(char1);
	}


	/**
	 * Updates parameter values for the next tick in time. 
	 * We need to pass in or have some access to the world parameters.
	 */
	public void step() {
		/*
		 * 1. Calculate expected regret for candidate ideologies
		 * 2. Find the ideology with the minimum expected regret
		 * 3. If the minimum is zero, choose that ideology. If not, optimize that ideology's beliefs until expected regret is zero.
		 * 4. ...
		 */
	}

	/**
	 * @param position the position to set
	 */
	public void setPosition(Point2D.Double position) {
		this.position = position;
	}

	/**
	 * @return the position
	 */
	public Point2D.Double getPosition() {
		return position;
	}

	/**
	 * @param history the history to set
	 */
//	public void setHistory(ArrayList<Event> history) {
//		this.history = history;
//	}
	
	public ArrayList<Double> getCharacter() {
		return character;
	}

	/**
	 * Adds an event to the person's history.
	 * @param evt
	 */
//	public void addEvent(Event evt) {
//		history.add(evt);
//	}

	/**
	 * @return the history
	 */
//	public ArrayList<Event> getHistory() {
//		return history;
//	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		String value = this.id + ", " + position.toString();
		//value += ", Characteristics: ";
		for (Double char1 : character) {
			value += ", " + char1.toString();
		}
		//value += ", History: ";
//		for (Event ev : history) {
//			value += ", " + ev.toString();
//		}
		return value;
		
	}
}
